package com.byq.mm.application.cluster.server;

import java.util.ArrayList;

import com.byq.mm.abstractx.device.Device;
import com.byq.mm.abstractx.engine.CoreEnvironment;
import com.byq.mm.abstractx.protocol.Interaction;
import com.byq.mm.application.cluster.provider.LevelControlProvider;
import com.byq.mm.application.cluster.provider.TunnelProvider;
import com.byq.mm.application.cluster.server.executor.LevelControlExecutor;

import com.byq.mm.foundation.cluster.datatype.AttributeValue;
import com.byq.mm.foundation.cluster.datatype.ByteArrayValue;
import com.byq.mm.foundation.cluster.datatype.DoubleRangeValue;
import com.byq.mm.foundation.cluster.datatype.DoubleValue;
import com.byq.mm.foundation.cluster.server.BasicClusterServer;

public class TunnelServer extends BasicClusterServer{


	public TunnelServer(String cluster, Device device, CoreEnvironment env) {
		super(cluster, device, env);
	}

	@Override
	public boolean onCommand(Interaction i, String transport) {
		return super.onCommand(i, transport);
		
		
		
	}
	public void onValueChange(ByteArrayValue value){
		attributes.put(TunnelProvider.Define.Attributes.DATA, value);
		this.broadcastAttributeToSubscription(TunnelProvider.Define.Attributes.DATA);
		
	}

	@Override
	protected Class<? extends AttributeValue> getAttributeType(String attributeName) {
		if(attributeName.equals(TunnelProvider.Define.Attributes.DATA))
			return ByteArrayValue.class;
		
		return null;
	}

	@Override
	protected void init() {
		attributes.put(TunnelProvider.Define.Attributes.DATA,new ByteArrayValue(new byte[0]));
		
	
		
		subscriber.put(TunnelProvider.Define.Attributes.DATA,  new ArrayList<String>());
		
	}


}
